home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
program
/
fpkpas92.zip
/
SRCRTL.ZIP
/
RTL
/
DOS
/
TRIANGLE.PPI
< prev
next >
Wrap
Text File
|
1997-07-01
|
1KB
|
44 lines
{ FILE: TRIANGLE.PPI }
procedure Triangle(A,B,C:PointType);
var temp : PointType;
yc,yl : Integer;
x1,x2,x3 : Integer;
y1,y2,y3 : Integer;
begin
if B.Y < A.Y then begin Temp:=A; A:=B; B:=Temp; end;
if C.Y < B.Y then begin Temp:=B; B:=C; C:=Temp; end;
if B.Y < A.Y then begin Temp:=A; A:=B; B:=Temp; end;
x1:=b.x-a.x; y1:=b.y-a.y;
x2:=c.x-b.x; y2:=c.y-b.y;
x3:=c.x-a.x; y3:=c.y-a.y;
yl:=b.y-a.y;
if y1 <> 0 then
for yc:=0 to y1 do
begin
patternline(a.x + yc * x1 div y1,a.x+ yc * x3 div y3,a.y+yc);
end;
if y2 <> 0 then
for yc:=0 to y2 do
begin
patternline(c.x - yc * x2 div y2,c.x - yc * x3 div y3,c.y-yc);
end;
end;
procedure Filltriangle(A,B,C:PointType);
begin
_graphresult:=grOK;
if not isgraphmode then
begin
_graphresult:=grnoinitgraph;
exit;
end;
Triangle(A,B,C);
if (aktcolor<>aktfillsettings.color) or (aktfillsettings.pattern<>1) then
begin
line(a.x,a.y,b.x,b.y);
line(b.x,b.y,c.x,c.y);
line(c.x,c.y,a.x,a.y);
end;
end;